package cn.highset.modules.base.entity;

import cn.highset.base.HighsetBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @author Victor
 */
@Data
@Entity
@Table(name = "t_activity")
@TableName("t_activity")
@SQLDelete(sql = "update t_activity set del_flag= 1 where id =?")
@SQLDeleteAll(sql = "update t_activity set del_flag= 1 where id =?")
@Where(clause = "del_flag=0")
@ApiModel(value = "活动信息")
public class Activity extends HighsetBaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "活动名称")
    private String activityName;
    @ApiModelProperty(value = "活动名称（英文）")
    private String activityNameEn;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @ApiModelProperty(value = "活动开始时间", hidden = true)
    private Date timeStart;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @ApiModelProperty(value = "活动结束时间", hidden = true)
    private Date timeEnd;

    @ApiModelProperty(value = "活动地点")
    private String address;
    @ApiModelProperty(value = "活动地点（英文）")
    private String addressEn;

    @ApiModelProperty(value = "主办单位")
    private String organizer;
    @ApiModelProperty(value = "主办单位（英文）")
    private String organizerEn;


    @ApiModelProperty(value = "承办单位")
    private String undertake;
    @ApiModelProperty(value = "承办单位（英文）")
    private String undertakeEn;

    @ApiModelProperty(value = "活动简介")
    private String introduction;
    @ApiModelProperty(value = "活动简介（英文）")
    private String introductionEn;

    @ApiModelProperty(value = "被收藏数量")
    private Integer collectCount = 0;

    @ApiModelProperty(value = "显示时间")
    private Boolean showTime = false;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "活动时间")
    private String date;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "活动时间英文")
    private String dateEn;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "活动开始时间 MM月dd日")
    private String startDate;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "活动开始时间 MMM dd")
    private String startDateEn;

}
